package com.seari.main;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import com.seari.utils.MiscTools;
import com.seari.commonutils.redis.JedisUtilProxy;

@Component
@Order(value = 1)
public class StartUpClass implements ApplicationRunner{
	
	protected static Logger logger = LoggerFactory.getLogger(StartUpClass.class);
	public static Properties config; 
	static String configFilePath = "config.cfg";

	public static String proRate;
	public static String imgProgressCount;
	public static  String queryCapDeviationByProid;
	public static  String queryInvDeviationByProid;


	public static String proInvest;
	public static String proInvestDown;
	public static String proInvertExplain;
	public static String moneyNum;
	public static String proMoneyNumDown;


	public static String proSearch;
	public static String major;
	public static String nature;
	public static String overview;
	public static String prolag;
	public static String prolist;
	public static String proCruxNode;
	public static String proMinorNode;
	

	@Override
	public void run(ApplicationArguments args) throws Exception
	{
		System.out.println("start up class loading...");
//        JedisUtilProxy.initJedisPoolUtil("127.0.0.1", 6379);
        init();
	}
	
	
    public void init(){
    	try
		{
			config = MiscTools.loadConfig(configFilePath);

			//仪表盘配置
			proRate = config.getProperty("proRate");
			imgProgressCount = config.getProperty("imgProgressCount");
			queryCapDeviationByProid = config.getProperty("queryCapDeviationByProid");
			queryInvDeviationByProid = config.getProperty("queryInvDeviationByProid");

			//子页面节点、投资数、资金数、形象进度
			proInvest = config.getProperty("proInvest");
			proInvestDown = config.getProperty("proInvestDown");
			proInvertExplain = config.getProperty("proInvertExplain");
			moneyNum = config.getProperty("moneyNum");
			proMoneyNumDown = config.getProperty("proMoneyNumDown");
			proCruxNode = config.getProperty("proCruxNode");
			proMinorNode = config.getProperty("proMinorNode");

			//下拉框选项及项目搜索功能
			proSearch = config.getProperty("proSearch");
			major = config.getProperty("major");
			nature = config.getProperty("nature");
			overview = config.getProperty("overview");
			prolag = config.getProperty("prolag");
			prolist = config.getProperty("prolist");

		} catch (Exception e)
		{
			// TODO: handle exception
			logger.warn(e.getMessage());
		}
    	logger.info("read config file complete");
    }
}